import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/views/login/index.vue'
// import store from '@/store'
// import NProgress from 'nprogress'
// import 'nprogress/nprogress.css'
// import chart from '@/views/chart/index.vue'
Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  {
    path: '/subject',
    component: () => import('@/views/subject/index'),
    hidden: true
  },
  {
    path: '/layout',
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '/layout/chart',
        component: () => import('@/views/chart/index.vue'),
        meta: { name: '数据概览', icon: 'el-icon-pie-chart' }
      },
      {
        path: '/layout/user',
        component: () => import('@/views/user/index.vue'),
        meta: {
          name: '用户列表',
          icon: 'el-icon-user'
        }
      },
      {
        path: '/layout/question',
        component: () => import('@/views/question/index.vue'),
        meta: { name: '题库列表', icon: 'el-icon-edit-outline' }
      },
      {
        path: '/layout/business',
        component: () => import('@/views/business/index.vue'),
        meta: { name: '企业列表', icon: 'el-icon-office-building' }
      },
      {
        path: '/layout/subject',
        component: () => import('@/views/subject/index.vue'),
        meta: { name: '学科列表', icon: 'el-icon-notebook-2' }
      }
    ]
  },
  {
    path: '/login',
    component: login,
    meta: { title: '登录', roles: ['超级管理员', '管理员', '老师', '学生'] }
  },
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  }
]

const router = new VueRouter({
  routes
})

router.afterEach((to, from) => {})
export default router
